package ch.usi.inf.pf2.editor;

import ch.usi.inf.pf2.Sheet;
import ch.usi.inf.pf2.cell.Cell;
import junit.framework.TestCase;
/**
 * 
 * @author Lorenzo Baracchi <lorenzo.baracchi@usi.ch>
 *
 */
public class TestTextInsert extends TestCase
{
    private Sheet s;
    private Cell c;
    private TextInsert ti;
    
    protected void setUp ()
    {
	   s=new Sheet();
	   s.initializeSheet();
	   c=s.getCell(1, 1);
	   c.setContent("hello");
	   ti = new TextInsert(s, 1, 1, "ciao");
    }
    
    public void testEvaluate ()
    {
	   ti.evaluate();
	   assertEquals("hello", ti.getOldText());
	   assertEquals("ciao", ti.getNewText());
	   assertEquals("ciao", c.getContent().toString());
    }
    
    public void testRestore ()
    {
	   ti.evaluate();
	   ti.restore();
	   assertEquals("hello", ti.getOldText());
	   assertEquals("ciao", ti.getNewText());
	   assertEquals("hello", c.getContent().toString());
    }
}
